package put.io.factory;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class Fabryka {
	
	public abstract class Plik {
		public abstract void wyswietl() throws FileNotFoundException, IOException;
	}

	public class PlikTekstowy extends Plik {

		@Override
		public void wyswietl() throws IOException {
			String filename = null;
			BufferedReader br = new BufferedReader(new FileReader(filename));
			String strLine = null;
			String tekst = null;
			while ((strLine  = br.readLine()) != null) {
				tekst += strLine + "\n";
			}
			
		}
		
	}
	
	public class Skrypt extends Plik{

		@Override
		public void wyswietl() throws IOException {
			String filename = null;
			BufferedReader br = new BufferedReader(new FileReader(filename));
			System.out.println(br.readLine());
			
		}
		
	}
	
	public class Inne extends Plik {

		@Override
		public void wyswietl() {
			System.out.println("Nie wspieram tego typu pliku");
			
		}
		
	}
	
	public abstract class Creator {
		public abstract Plik createProduct();
	}
	
	public class ConcreteCreator extends Creator {

		@Override
		public Plik createProduct() {
			int wybor=1;
			switch(wybor){
			case 1:
				return new PlikTekstowy();
			case 2:
				return new Skrypt();
			case 3:
				return new Inne();
			}
			return null;
		}
		
	}
}
